package com.fact.utils.startup;

import java.io.IOException;
import java.util.Calendar;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.fact.helper.MonthService;
import com.fact.models.RoleService;



public class StartupResources  extends HttpServlet {
	
	private static final long serialVersionUID = -7227671581272961718L;

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
	      throws ServletException, IOException {
		  
	  }
	


	public void init(ServletConfig config)  throws ServletException
	{	
		RoleService    roleService=new RoleService();
		MonthService    monthService=new MonthService();
		super.init(config);
		config.getServletContext().setAttribute("SLOGAN_PREFIX", "FACT");
		config.getServletContext().setAttribute("SLOGAN_SAFIX", "entry");
		config.getServletContext().setAttribute("ALL_ROLE",roleService.getRoleList());
		
		config.getServletContext().setAttribute("ALL_MONTH",monthService.getMothList());
		
		config.getServletContext().setAttribute("CURRENT_YEAR",Calendar.getInstance().get(Calendar.YEAR));
		config.getServletContext().setAttribute("CURRENT_MONTH",Calendar.getInstance().get(Calendar.MONTH)+1);

		
		/*
		CountryService countryService=new CountryService();
		StationService stationService=new StationService();
		RoleService    roleService=new RoleService();
		UserService    userService=new UserService();
		CustomerService customerService=new CustomerService();
		CommodityService commodityService=new CommodityService();
		FlightService flightService=new FlightService();
		FlightLegService flightLegService=new FlightLegService();
		AwbService awbService=new AwbService();
		PaymentService paymentService=new PaymentService();
		PrincipalService principalService=new PrincipalService();
		
		super.init(config);
		config.getServletContext().setAttribute("ALL_COUNTRY", countryService.getCountryList(0,0,0));
		config.getServletContext().setAttribute("ALL_STATION", stationService.getStationList(0,0,0));
		config.getServletContext().setAttribute("ALL_ROLE",roleService.getRoleList());
		config.getServletContext().setAttribute("ALL_USER",userService.getUserList(0,0,0));
		config.getServletContext().setAttribute("ALL_CUSTOMER",customerService.getCustomerList(0,0,0));
		config.getServletContext().setAttribute("ALL_COMMODITY",commodityService.getCommodityList(0,0,0));
		config.getServletContext().setAttribute("ALL_FLIGHT",flightService.getFlightList(0,0,0));
		
		config.getServletContext().setAttribute("ALL_PRINCIPAL_AWB_LIST",awbService.getPrincipalAWBList(0,0,0));
		config.getServletContext().setAttribute("ALL_PRINCIPAL",principalService.getPrincipalList(0,0,0));
		
		config.getServletContext().setAttribute("AWB_PREFIX",awbService.getAwbPrefix());
		config.getServletContext().setAttribute("ALL_PAYMENT_TYPE",paymentService.getPaymentTypesList());
		
		
		config.getServletContext().setAttribute("ALL_TRACKING_STATUS_SOURCE",flightLegService.getStatusListFromStatusTypeName("SOURCE"));
		config.getServletContext().setAttribute("ALL_TRACKING_STATUS_IN-TRANSIT",flightLegService.getStatusListFromStatusTypeName("IN-TRANSIT"));
		config.getServletContext().setAttribute("ALL_TRACKING_STATUS_DESTINATION",flightLegService.getStatusListFromStatusTypeName("DESTINATION"));
		
		config.getServletContext().setAttribute("ALL_TRACKING_STATUS",flightLegService.getStatusListFromAll());
		
		
		System.setProperty("SMTP_HOST_NAME", "Host");
		System.setProperty("SMTP_AUTH_USER", "User");
		System.setProperty("SMTP_AUTH_PWD", "Pwd");
		*/
		
	}

}